<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    //return $router->app->version();
    echo phpinfo();
});


//后台接口
$router->group(['prefix'=>'api/admin', 'namespace'=>'Admin'], function () use ($router) {
    $router->post('login', 'LoginController@dologin'); //登录
    $router->post('info', 'LoginController@getInfo'); //用户信息

    //普通功能
    $router->group(['prefix'=>'low', 'namespace'=>'Low'], function () use ($router) {
        $router->post('person/index', 'PersonController@index');
        $router->post('company/index', 'CompanyController@index');
    });

    //平台管理功能
    $router->group(['prefix'=>'plat', 'namespace'=>'Platform'], function () use ($router) {
        include_once('plat.php');
    });

    //代码功库能
    $router->post('mk/word/index', 'MkWordController@getIndex');
    $router->post('mk/word/option', 'MkWordController@getOption');
    $router->post('mk/word/add', 'MkWordController@add');
    $router->post('mk/word/modify', 'MkWordController@modify');
    $router->post('mk/word/del', 'MkWordController@del');
    //AI测试
    $router->post('test/bd/ocr', 'TestAiController@bdocr'); //百度识别
    $router->post('test/al/tyqw', 'TestAiController@altyqw'); //阿里通义千问

    //用户项目库
    $router->post('item/index', 'ItemController@getIndex'); //项目列表
    $router->post('item/one', 'ItemController@getOne'); //项目详情
    $router->post('item/upload', 'ItemController@upload'); //压缩包上传
    $router->post('item/read', 'ItemController@read'); //读取文件内容
    $router->post('item/save', 'ItemController@save'); //保存文件
    $router->post('item/export', 'ItemController@export'); //导出
    $router->get('item/down', 'ItemController@down'); //下载
    $router->post('item/setadmin', 'ItemController@setAdmin'); //配置后台
    //代码生成器
    $router->post('maker/option', 'MakerController@getOption'); //选项
    $router->post('maker/item/add', 'MakerController@itemAdd'); //创建项目
    $router->post('maker/upload', 'MakerController@upload'); //上传设计图
    $router->post('maker/wordbyai', 'MakerController@wordByAi'); //识别
    $router->post('maker/mate', 'MakerController@mate'); //匹配
    $router->post('maker/tofront', 'MakerController@mkFront'); //生成前端页面

    //模板项目库
    $router->post('tmp/index', 'TmpController@getIndex');
    $router->post('tmp/one', 'TmpController@getOne');
    $router->post('tmp/upload/front', 'TmpController@uploadFront'); //上传前端页面
    $router->post('tmp/upload/admin', 'TmpController@uploadAdmin'); //上传后端页面
    //模板接口
    $router->post('tmp/doc/index', 'TmpDocController@getIndex'); //接口列表
    $router->post('tmp/doc/one', 'TmpDocController@getOne'); //接口详情
    //$router->post('tmp/doc/test', 'TmpDocController@test'); //接口测试
    $router->post('tmp/doc/add', 'TmpDocController@add'); //接口添加
    $router->post('tmp/doc/modify', 'TmpDocController@modify'); //接口修改
    $router->post('tmp/doc/del', 'TmpDocController@del'); //接口删除
    //用户项目库
    $router->post('tmp/user/apply', 'TmpUserController@apply'); //领取模板
    $router->post('tmp/user/index', 'TmpUserController@getIndex'); //项目列表
    $router->post('tmp/user/one', 'TmpUserController@getOne'); //项目详情
    $router->post('tmp/user/file/read', 'TmpUserController@fileRead'); //读取文件内容
    $router->post('tmp/user/file/save', 'TmpUserController@fileSave'); //保存文件内容
    $router->post('tmp/user/copy', 'TmpUserController@copy'); //复制
    $router->post('tmp/user/export', 'TmpUserController@export'); //导出
    $router->get('tmp/user/down', 'TmpUserController@down'); //下载
    //用户项目接口
    $router->post('xm/doc/index', 'TmpUserController@getDocIndex'); //用户接口列表
    $router->post('xm/doc/one', 'TmpUserController@getDocOne'); //用户接口详情
});


//项目接口
$router->group(['prefix'=>'api/item', 'namespace'=>'Item'], function () use ($router) {
    include_once('item.php');
});